
$(".logins").click(function(e){
        var username=$("#username").val();
        var password=$("#password").val();
        $.ajax({
            type:'POST',
            url:'http://localhost:8080/front/login',
            data:{"username":username,"password":password},
            success:function (data) {
                var Objdata=JSON.parse(data);
                $.cookie("name",Objdata.name);
                $.cookie("image",Objdata.image);
                console.log($.cookie("name"));
                $(".login-p").text($.cookie("name"));
                $('#myModal').modal('toggle');
                $(".email").css("display","none");
                window.location.reload()
            },error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(2+" "+XMLHttpRequest + " " + textStatus + " " + errorThrown)
            }
        });
    }
)
$(".registers").click(
    function (e) {
        var name=$("#name").val();
        var phone=$("#phone").val();
        var password=$("#passwords").val();
        $.ajax({
            url:'http://localhost:8080/front/register',
            type:'POST',
            data:{"name":name,"phone":phone,"password":password},
            success:function (data) {
                $('#myModal1').modal('toggle');
                if(data=="1"){
                    alert("成功")
                }else{
                    alert("失败")
                }

            }
        })
    }
)

var vm=new Vue({
    el:"#bs-example-navbar-collapse-1",
    data:{
        name:$.cookie("name"),
        image:$.cookie("image")
    }

})



var sm=new Vue({
    el:".friend-grids",
    data:{
        goodhourse:[]
    },
    mounted:function(){
        this.good();
    },
    methods:{
        good:function () {
            this.$nextTick(function () {
                this.$http.post('http://localhost:8080/front/secondok').then(function (res) {
                    this.goodhourse=res.data;
                    console.log(this.goodhourse);
                })
            })
        }
    }
})

new Vue({
    el:".offer-grids",
    data:{
        newhourse:[]
    },
    mounted:function(){
      this.newh();
    },
    methods:{
        newh:function () {
            this.$nextTick(function () {
                this.$http.post('http://localhost:8080/front/newhourse').then(function (res) {
                    this.newhourse=res.data;
                    console.log(this.newhourse);
                })
            })
        }
    }
})

new Vue({
    el:".feature-grids",
    data:{
        alldata:[]
    },
    mounted:function(){
        this.allfloor();
    },
    methods:{
        allfloor:function () {
            this.$nextTick(function () {
                this.$http.post('http://localhost:8080/front/recommend').then(function (res) {
                    this.alldata=res.data;
                    console.log(this.alldata);
                })
            })
        }
    }
})

new Vue({
    el:".membership-grids",
    data:{
        alldata:[]
    },
    mounted:function(){
        this.broker();
    },
    methods:{
        broker:function () {
            this.$nextTick(function () {
                this.$http.post('http://localhost:8080/front/broker').then(function (res) {
                    this.alldata=res.data;
                    console.log(this.alldata);
                })
            })
        }
    }
})